package com.bruce.demo2.patterns.demo1.creational.demo02.factoryMethod.demo5;

/**
 * @PROJECT_NAME design_patterns
 * @DESCRIPTION 咖啡店 根据客户端指定的工厂生产咖啡
 * @AUTHOR CNBruceLee
 * @DATE 2021/7/11 9:51
 */
public class CoffeeStore {

    private CoffeeFactory factory;

    public void setFactory(CoffeeFactory factory) {
        this.factory = factory;
    }

    //点咖啡的功能
    public Coffee orderCoffee() {
        Coffee coffee = this.factory.createCoffee();
        //加配料
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
